import http from '../utils/request';
import Qs from "qs";
import {data} from "autoprefixer";
import {replaceUrl} from "postcss-url/src/lib/decl-processor";

//注册
export  function register(data) {
  return http({
    url: '/user/saveUser',
    method: 'post',
    data
  })
}
//登录
export function Login(data){
  return http({
    url:'/user/lcmLogin',
    method:'post',
    data
  })
}
//短信登录
export function smsLogin(data){
  return http({
    url:'v-code/checkCode',
    method:'post',
    data
  })
}

//删除用户
export function DeleteUser(data){
  return http({
    url:`user/removeUser`,
    method:'delete',
    data
  })
}
//请求用户数据
export function AllUserData(){
  return http({
    url:'user/selectAll',
    method:'post'
  })
}
//用户分页
export function UserDividePage(data){
  return http({
    url:'user/page',
    method:'post',
    data
  })
}
//通过账户查询用户
export function FindUserByAccount(data){
  return http({
    url:'user/getUserMsg?account='+data,
    method:'post'
  })
}
//通过电话号码查询用户
export function FindUserByPhone(data){
  return http({
    url:'user/selectByPhone',
    method:'post',
    data
  })
}
//修改用户信息
export function UpdateUser(data){
  return http({
    url:'user/updateUser',
    method:'post',
    data
  })
}


/******************商品模块***************/
  //获取所有商品信息
export function getGoodsInfo(){
  return http({
    url:'goods/getAll',
    method:'get'
  })
}
  //分类查询商品信息
export function getGoodsByClass(data){
  return http({
    url:'goods/selectByClass',
    method:'post',
    data
  })
}
  //创建商品订单
export function saveGoodsDetail(data){
  return http({
    url:'goods-detail/saveGoodsDetail',
    method:'post',
    data
  })
}
  //添加商品信息
export function AddGoodsInfo(data){
  return http({
    url:'goods/saveGoods',
    method:'post',
    data
  })
}
  //商品分页
export function GoodsDividePage(data){
  return http({
    url:'goods/page',
    method:'post',
    data
  })
}
  //修改商品价格
export function changeGoodsPrice(data){
  return http({
    url:'goods/updateGoods',
    method:'post',
    data
  })
}
  //删除商品信息
export function RemoveGoods(data){
  return http({
    url:'goods/removeGoods',
    method:'delete',
    data
  })
}
  //根据商品名查找
export function SelectGoodsByName(data){
  return http({
    url:'goods/selectGoods',
    method:'post',
    data
  })
}

/*************外卖模块*******************/
  //获取所有外卖信息
export function getFoodsInfo(){
  return http({
    url:'dish/getAll',
    method:'get'
  })
}
  //分类查询外卖信息
export function  getFoodsByClass(data){
  return http({
    url:'dish/selectByClass',
    method:'post',
    data
  })
}
  //创建外卖订单
export function  saveFoodsDetail(data){
  return http({
    url:'dish-detail/saveDishDetail',
    method:'post',
    data
  })
}
  //外卖分页
export function DishDividePage(data){
  return http({
    url:'dish/page',
    method:'post',
    data
  })
}
  //添加外卖信息
export function AddDishInfo(data){
  return http({
    url:'dish/saveDish',
    method:'post',
    data
  })
}
  //查找外卖信息
export function SelectDishByName(data){
  return http({
    url:'dish/selectDish',
    method:'post',
    data
  })
}
  //修改外卖价格
export function changeDishPrice(data){
  return http({
    url:'dish/updateDish',
    method:'post',
    data
  })
}
  //删除外卖信息
export function RemoveFoods(data){
  return http({
    url:'dish/removeDish',
    method:'delete',
    data
  })
}

/*用户订单模块*/
  //用户页面查看订单信息分页
export function userGetOrderInfo(data){
  return http({
    url:'order/page3',
    method:'post',
    data
  })
}
  //根据订单表的菜品明细ID查找菜品明细
export function serachDishDetailById(data){
  return http({
    url:'dish-detail/selectByOrder',
    method:'post',
    data
  })
}
  //根据订单表的商品明细ID查找商品明细
export function serachGoodsDetailById(data){
  return http({
    url:'goods-detail/selectByOrder',
    method:'post',
    data
  })
}
  //根据明细表的菜品ID查找菜品信息
export function searchDishById(data){
  return http({
    url:'dish/selectByDetail',
    method:'post',
    data
  })
}
  //根据明细表的菜品ID查找菜品信息
export function searchGoodsById(data){
  return http({
    url:'goods/selectByDetail',
    method:'post',
    data
  })
}
  //根据orderID查订单信息
export function searchOrderInfoById(data){
  return http({
    url:'order/selectOrder',
    method:'post',
    data
  })
}

/*预约信息模块*/
  //新增医疗预约信息
export function saveMedicalDetail(data){
  return http({
    url:'medicalschedule/saveMedicalSchedule',
    method:'post',
    data
  })
}
 //新增绿化基地预约信息
export function saveBaseDetail(data){
  return http({
    url:'visitingschedule/saveVisitingSchedule',
    method:'post',
    data
  })
}
  //预约信息分页
export function userGetReservationInfo(data){
  return http({
    url:'reservation/page3',
    method:'post',
    data
  })
}
  //通过medicalId查medicalschedule表信息(未完成)
export function searchMedicalById(data){

}
 //通过visitId查visitingschedule表信息(未完成)
export function searchVisitById(data){

}
  //通过预约表id查询预约信息
export function searchReservationById(data){
  return http({
    url:'reservation/selectReservation',
    method:'post',
    data
  })
}


